package com.xpq.ddns;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@EnableScheduling
@SpringBootApplication
public class Application {
    @Autowired
    private DDNSStarter ddnsStarter;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    /**
     * 每三分钟检查一次IP是否发生改变，如果改变，则进行一次域名解析
     */
    @Scheduled(fixedRate = 1000*60*3)
    public void doDns() {
        ddnsStarter.start();
    }

}
